import {
  getGameList,
  getSearchList,
  getEditgameList
} from "@/api/gameManage"

const gameManage = {
  state: {
    gamesearch: {
      game_audit_id: "",
      gameId: "",
      game_plat_id: "",
      page: 1,
      limit: 20
    }
  },
  getters: {
    gamesearch: state => state.gamesearch
  },
  mutations: {
    SET_SEARCH: (state, payload) => {
      state.gamesearch = payload;
    }
  },
  actions: {
    // 获取游戏列表
    getGameList({
      commit
    }, reqData) {
      return new Promise(resolve => {
        getGameList(reqData).then(response => {
          const data = response.data;
          resolve(data);
        });
      })
    },
    // 获取搜索列表
    getSearchList({
      commit
    }, reqData) {
      return new Promise(resolve => {
        getSearchList(reqData).then(response => {
          const data = response.data;
          resolve(data);
        });
      })
    },
    // 获取编辑游戏列表信息
    getEditgameList({
      commit
    }, reqData) {
      return new Promise(resolve => {
        getEditgameList(reqData).then(response => {
          const data = response.data;
          resolve(data);
        });
      })
    },
    // 获取关联游戏列表
    getlinkgame({
      commit
    }, reqData) {
      return new Promise(resolve => {
        getlinkgame(reqData).then(response => {
          const data = response.data;
          resolve(data);
        });
      })
    },
  }
}
export default gameManage
